package com.company.cloud.art.modules.mgr.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.company.cloud.art.modules.base.entity.CustUserInfoVto;
import com.company.cloud.art.modules.cache.models.ExpoJoinCompanyModel;
import com.company.cloud.art.modules.cache.models.ExpoJoinProductModel;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface ExpoJoinMapper {


    @Select("SELECT a.id as id ,a.expo_no as expoNo ,a.org_no as orgNo,a.booth_no as boothNo,a.state as state,a.bizVal as bizVal ," +
            "a.orders as orders, b.name as name,b.logo as logo " +
            "FROM art_expo_join_info a inner JOIN com_company_info b on (a.org_no=b.company_no) ${ew.customSqlSegment}")
    public IPage<ExpoJoinCompanyModel> queryExpoJoinCompany(IPage<ExpoJoinCompanyModel> page, @Param(Constants.WRAPPER) Wrapper<ExpoJoinCompanyModel> wrapper);



    @Select("SELECT b.company_no as orgNo,b.name ,b.logo " +
            "FROM  com_company_info b  ${ew.customSqlSegment}")
    public IPage<ExpoJoinCompanyModel> queryExpoJoinCompany2(IPage<ExpoJoinCompanyModel> page, @Param(Constants.WRAPPER) Wrapper<ExpoJoinCompanyModel> wrapper);



    @Select("SELECT a.id as id ,a.expo_no as expoNo ,a.org_no as orgNo,a.booth_no as boothNo,a.state as state,a.bizVal as bizVal,b.name as name,b.logo as logo " +
            "FROM art_expo_join_info a inner JOIN com_company_info b on (a.org_no=b.company_no) ${ew.customSqlSegment}")
    public List<ExpoJoinCompanyModel> listExpoJoinCompany(@Param(Constants.WRAPPER) Wrapper<ExpoJoinCompanyModel> wrapper);





//    where 1=1
//    ORDER BY b.orders DESC

    @Select(" SELECT  a.name as expoName, " +
            " b.id as id,b.join_id as joinId, b.expo_no as expoNo, b.org_no as orgNo,b.prd_no as prdNo,b.orders as orders ,b.remark as remark, " +
            " c.name as prdName, c.caption as prdCaption ,c.image as prdImage ,c.price as prdPrice,c.biz_value4 as prdBizValue4 ," +
            " c.biz_value5 as prdBizValue5 , c.biz_value6 as prdBizValue6 ,c.biz_value18 as prdBizValue18" +
            " FROM art_expo_info a INNER JOIN art_expo_join_product_info b on (a.id=b.expo_no)  INNER JOIN prd_product_info c on (b.prd_no=c.product_no)" +
            " ${ew.customSqlSegment}")
    public IPage<ExpoJoinProductModel> queryExpoJoinProduct(IPage<ExpoJoinProductModel> page, @Param(Constants.WRAPPER) Wrapper<ExpoJoinProductModel> wrapper);

    @Select("select  id as id,nick_name as userName, mobile as phone  from cust_user_info where id=#{id}")
    CustUserInfoVto CustUserId(@Param("id")int id);

}
